home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / utility / gs25dos1.zip / LANGUAGE.DOC < prev    next >
Text File  |  1992-08-15  |  14KB  |  378 lines

  1.    Copyright (C) 1989-1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.
  19.  
  20. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  21.  
  22. This file, language.doc, describes the Ghostscript language.
  23.  
  24. For an overview of Ghostscript and a list of the documentation files, see
  25. README.
  26.  
  27. The Ghostscript interpreter, except as noted below, is intended to execute
  28. properly any source program written in a language defined by reference to
  29. the December 1990 printing of the PostScript Language Reference Manual
  30. (Second Edition) published by Addison-Wesley (ISBN 0-201-18127-4).  The
  31. Ghostscript language includes the following elements of the PostScript
  32. (TM) language:
  33.  
  34.     - The full PostScript Level 1 language, as also defined in the
  35. first edition of the PostScript Language Reference Manual, ISBN
  36. 0-201-10174-2, Addison-Wesley, 1985.
  37.  
  38.     - The CMYK color, file system, version 25.0 language, and
  39. miscellaneous additions listed in sections A.1.4, A.1.6, A.1.7, and A.1.8
  40. of the Second Edition respectively.
  41.  
  42.     - The Display PostScript extensions listed in section A.1.3 of the
  43. Second Edition, but excluding the operators listed in section A.1.2, and
  44. also excluding setbbox, xshow, xyshow, and yshow.  These extensions are
  45. only available if the dps feature was selected at the time that
  46. Ghostscript was compiled and linked.
  47.  
  48.     - A few other PostScript Level 2 operators, listed below.
  49.  
  50. Ghostscript also includes a number of operators defined below that are not
  51. in the PostScript language.
  52.  
  53. Stub facilities
  54. ---------------
  55.  
  56. The following operators, while provided in the current release, have only
  57. a partial or dummy implementation.
  58.  
  59. Character and font operators:
  60.     cshow, rootfont, setcachedevice2
  61.  
  62. Graphics state operators:
  63.     currentblackgeneration, currentcmykcolor, currentcolorscreen,
  64.     currentcolortransfer, currenthalftonephase, currentundercolorremoval,
  65.     setblackgeneration, setcmykcolor, setcolorscreen,
  66.     setcolortransfer, sethalftonephase, setundercolorremoval,
  67.     currenthalftone, sethalftone,
  68.     setbbox
  69.  
  70. Interpreter parameter operators:
  71.     setucacheparams, ucachestatus
  72.  
  73. Path construction operators:
  74.     ucache
  75.  
  76. Virtual memory operators:
  77.     currentshared, scheck, setshared, setvmthreshold, shareddict,
  78.     SharedFontDirectory, vmreclaim
  79.  
  80. Level 2 operators
  81. -----------------
  82.  
  83. The following PostScript Level 2 operators are available in
  84. Ghostscript.  Unless otherwise noted, these are only available if the
  85. level2 feature was selected at the time that Ghostscript was compiled
  86. and linked.
  87.  
  88. File operators:
  89.        filter (not all filters are implemented, and most of the
  90.       implemented ones are only available if the filter feature was
  91.       selected when Ghostscript was built)
  92.  
  93. Graphics state operators:
  94.     currentcolor, currentcolorspace, setcolor, setcolorspace
  95.       (for DeviceGray, DeviceRGB, and DeviceCMYK only)
  96.     currentstrokeadjust, setstrokeadjust (even if level2 is
  97.       not selected)
  98.  
  99. In addition, Ghostscript supports the following Level 2 facilities:
  100.  
  101.     - Use of a string with the status operator (even if level2 is
  102. not selected);
  103.  
  104.     - Use of a dictionary with the image and imagemask operators;
  105.  
  106.     - Use of a string or a file as data source with the image,
  107. imagemask, and colorimage operators (even if level2 is not selected).
  108.  
  109. Ghostscript-specific additions
  110. ==============================
  111.  
  112. Miscellaneous
  113. -------------
  114.  
  115. ^Z is counted as whitespace.
  116.  
  117. run can take either a string or a file as its argument.  In the former
  118. case, it uses findlibfile to open the file (searching directories as
  119. needed).  In the latter case, it just runs the file, closing it at the
  120. end, and trapping errors just as for the string case.
  121.  
  122. Mathematical operators
  123. ----------------------
  124.  
  125.     <number> arccos <number>
  126.         Computes the arc cosine of a number between -1 and 1.
  127.  
  128.     <number> arcsin <number>
  129.         Computes the arc sine of a number between -1 and 1.
  130.  
  131. Dictionary operators
  132. --------------------
  133.  
  134.     <dict> <integer> setmaxlength -
  135.         Changes the capacity of a dictionary, preserving its
  136.           contents.  Causes a dictfull error if the requested
  137.           capacity is less than the current number of occupied
  138.           entries.
  139.  
  140. String operators
  141. ----------------
  142.  
  143.     <string|name|other> <patternString> stringmatch <boolean>
  144.         Determines whether the string or name matches the given
  145.           pattern.  In the pattern, `*' matches any substring of
  146.           the string, `?' matches any single character, and `\'
  147.           quotes the next character.  If the first argument is not
  148.           a string or name, stringmatch returns true if
  149.           patternString is a single *, and false otherwise.
  150.  
  151.     <state> <fromString> <toString> type1encrypt <newState> <toSubstring>
  152.         Encrypts fromString according to the algorithm for Adobe
  153.           Type 1 fonts, writing the result into toString.
  154.           toString must be at least as long as fromString or a
  155.           rangecheck error occurs.  state is the initial state of
  156.           the encryption algorithm (a 16-bit non-negative
  157.           integer); newState is the new state of the algorithm.
  158.  
  159.     <state> <fromString> <toString> type1decrypt <newState> <toSubstring>
  160.         Decrypts fromString according to the algorithm for Adobe
  161.           Type 1 fonts, writing the result into toString.  Other
  162.           specifications are as for type1encrypt.
  163.  
  164. Relational operators
  165. --------------------
  166.  
  167.     <number|string> <number|string> max <number|string>
  168.         Returns the larger of two numbers or strings.
  169.  
  170.     <number|string> <number|string> min <number|string>
  171.         Returns the smaller of two numbers or strings.
  172.  
  173. File operators
  174. --------------
  175.  
  176.     <string> findlibfile <foundstring> <file> true or <string> false
  177.         Opens the file of the given name for reading.  If the file
  178.           cannot be opened using the supplied name, searches
  179.           through directories as described in use.doc.  If the
  180.           search fails, findlibfile simply pushes false on the
  181.           stack and returns, rather than causing an error.
  182.  
  183.     <file> <integer> unread -
  184.          Pushes back the last-read character onto the front of the
  185.           file.  If the file is only open for writing, or if the
  186.           integer argument is not the same as the last character
  187.           read from the file, causes an ioerror error.  May also
  188.           cause an ioerror if the last operation on the file was not
  189.           a reading operation.
  190.  
  191.     <file> <device> writeppmfile -
  192.         Writes the contents of the device, which must be an image
  193.           device, onto the file, in Portable PixMap (ppm) format.
  194.           Does not close the file.
  195.  
  196. Path operators
  197. --------------
  198.  
  199.     <x> <y> <width> <height> rectappend -
  200.     <numarray> rectappend -
  201.     <numstring> rectappend -
  202.         Appends a rectangle or rectangles to the current path, in
  203.           the same manner as rectfill, rectclip, etc.  Only
  204.           defined if the dps option is selected.
  205.  
  206. Filters
  207. -------
  208.  
  209. Ghostscript supports all standard filters except DCTEncode and
  210. DCTDecode.  Ghostscript does not support the use of a procedure as a
  211. data source or sink, only a file or a string.  In addition,
  212. Ghostscript supports two non-standard filters:
  213.  
  214.     <file|string> <seed_integer> /eexecDecode filter <file>
  215.         Creates a filter for decrypting data that has been
  216.           encrypted using eexec encryption as described in the
  217.           Adobe Type 1 Font Format documentation.  The
  218.           seed_integer must be 55665 for proper operation.
  219.  
  220.     <file|string> <hex_boolean> /PFBDecode filter <file>
  221.         Creates a filter that decodes data in .PFB format, the
  222.           usual semi-binary representation for Type 1 font files
  223.           on IBM PC and compatible systems.  If hex_boolean is true,
  224.           binary packets are converted to hex; if false, binary
  225.           packets are not converted.
  226.  
  227. Miscellaneous operators
  228. -----------------------
  229.  
  230.     - currenttime <number>
  231.         Returns the current value of a continuously-running timer,
  232.           in minutes.  The initial value of this timer is undefined.
  233.  
  234.     <string> getenv   <string> true  or  false
  235.         Looks up a name in the shell environment.  If the name is
  236.           found, returns the corresponding value and true; if the
  237.           name is not found, returns false.
  238.  
  239.     <name> <array> makeoperator <operator>
  240.         Constructs and returns a new operator that is actually the
  241.           given procedure in disguise.  The name is only used for
  242.           printing.  The operator has the executable attribute.
  243.  
  244.     <string> <boolean> setdebug -
  245.         If the Ghostscript interpreter was built with the DEBUG
  246.           flag set, sets or resets any subset of the debugging
  247.           flags normally controlled by -Z in the command line.
  248.           Has no effect otherwise.
  249.  
  250. Device operators
  251. ----------------
  252.  
  253.     <device> copydevice <device>
  254.         Copies a device.
  255.  
  256.     <index> getdevice <device>
  257.         Returns a device from the set of devices known to the
  258.           system.  The first device, which is default, is numbered
  259.           0.  If the index is out of range, causes a rangecheck
  260.           error.
  261.  
  262.     <matrix> <width> <height> <palette> makeimagedevice <device>
  263.         Makes a new device that accumulates an image in memory.
  264.           matrix is the initial transformation matrix: it must be
  265.           orthogonal (i.e., [a 0 0 b x y] or [0 a b 0 x y]).
  266.           palette is a string of 2^N or 3*2^N elements, specifying
  267.           how the 2^N possible pixel values will be interpreted.
  268.           Each element is interpreted as a gray value, or as RGB
  269.           values, multiplied by 255.  For example, if you want
  270.           a monochrome image for which 0=white and 1=black, the
  271.           palette should be <ff 00>; if you want a 3-bit deep
  272.           image with just the primary colors and their complements
  273.           (ignoring the fact that 3-bit images are not supported),
  274.           the palette might be <000000 0000ff 00ff00 00ffff
  275.           ff0000 ff00ff ffff00 ffffff>.  At present,
  276.           the palette must contain exactly 2 or 256 entries,
  277.           and must contain an entry for black and an entry
  278.           for white; if it contains any entries that aren't black,
  279.           white, or gray, it must contain at least the six primary
  280.           colors (red, green, blue, and their complements cyan,
  281.           magenta, and yellow); aside from this, its contents are
  282.           arbitrary.  (4-entry or 16-entry palettes, corresponding
  283.           to 2- or 4-bit pixels, may be supported eventually.)
  284.         Alternatively, palette can be null.  This is interpreted
  285.           as 32-bit-per-pixel color, where the four bytes of each
  286.           pixel are respectively unused, R, G, and B.
  287.         Note that one can also make an image device (with the same
  288.           palette as an existing image device) by copying a device
  289.           using the copy operator.
  290.  
  291.     <device> <index> <string> copyscanlines <substring>
  292.         Copies one or more scan lines from an image device into a
  293.           string, starting at a given scan line in the image.
  294.           The data is in the same format as for the image
  295.           operator.  Error if the device is not an image device or
  296.           if the string is too small to hold at least one complete
  297.           scan line.  Always copies an integral number of scan
  298.           lines.
  299.  
  300.     <device> setdevice -
  301.         Sets the current device to the specified device.  Also
  302.           resets the transformation and clipping path to the
  303.           initial values for the device.
  304.  
  305.     - currentdevice <device>
  306.         Gets the current device from the graphics state.
  307.  
  308.     <device> devicename <string>
  309.         Gets the name of a device.
  310.  
  311.     <device> <matrix> deviceinitialmatrix <matrix>
  312.         Gets the initial matrix of a device, i.e., the one that
  313.           defaultmatrix would return if the device were the
  314.           current device.
  315.  
  316.     <device> getdeviceprops <mark> <name1> <value1> ... <namen> <valuen>
  317.         Gets all the properties of a device.  Currently defined
  318.           names and values for all devices are:
  319.             Name <string>
  320.                 device name
  321.             HWResolution [<float> <float>]
  322.                 X and Y resolution in pixels/inch
  323.             HWSize [<integer> <integer>]
  324.                 X and Y size in pixels
  325.             InitialMatrix [<6 floats>]
  326.                 initial transformation matrix
  327.         For printers, the following are also defined:
  328.             MaxBitmap <integer>
  329.                 maximum space for a full bitmap in RAM
  330.             BufferSpace <integer>
  331.                 buffer space for band lists, if the bitmap
  332.                   is too big to fit in RAM
  333.             OutputFile <string>
  334.                 () means send to printer directly,
  335.                   otherwise specifies the file name for
  336.                   output; a * is replaced by the page #;
  337.                   on Unix systems, (|command) writes to a pipe
  338.  
  339.     <mark> <name1> <value1> ... <namen> <valuen> <device>
  340.         putdeviceprops <device>
  341.         Sets properties of a device.  May cause undefined,
  342.           typecheck, rangecheck, or limitcheck errors.
  343.  
  344.     - flushpage -
  345.         On displays, flushes any buffered output, so that it
  346.           is guaranteed to show up on the screen; on printers,
  347.           has no effect.
  348.  
  349. Character operators
  350. -------------------
  351.  
  352.     <string> type1addpath -
  353.         Adds the description of a character to the current path,
  354.           and then optionally renders the character.  The string
  355.           argument is a scalable description encoded in Adobe Type
  356.           1 format.  This operator is only valid in the context of
  357.           a show operator, like setcharwidth and setcachedevice.
  358.           It uses information from the current font, in addition
  359.           to the argument.
  360.  
  361.     <font> <char> Type1BuildChar -
  362.         This is not a new operator: rather, it is a name known
  363.           specially to the interpreter.  Whenever the interpreter
  364.           needs to render a character (during a ...show,
  365.           stringwidth, or charpath), it looks up the name
  366.           BuildChar in the font dictionary to find a procedure to
  367.           run.  If it does not find this name, and if the FontType
  368.           is 1, the interpreter instead uses the value (looked up
  369.           on the dictionary stack in the usual way) of the name
  370.           Type1BuildChar.
  371.         The standard definition of Type1BuildChar is in gs_fonts.ps.
  372.           Users should not need to redefine Type1BuildChar, except
  373.           perhaps for tracing or debugging.
  374.  
  375. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  376.  
  377. PostScript is a trademark of Adobe Systems, Incorporated.
  378.